package com.zit.dao;

import java.util.List;

import org.hibernate.Session;

import com.zit.entity.Bedroom;
import com.zit.entity.Dorm;

public class DormDAO extends BaseDAO {
	
	/**
	 * 功能：查询公寓
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<Dorm> selectDorm(Session s){
		return (List<Dorm>) s.createQuery("from Dorm").list();
	}
	
	/**
	 * 功能：查询公寓对应的宿舍
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public List<Bedroom> selectBedroom(Session s,int id){
		return (List<Bedroom>) s.createQuery("from Bedroom t where t.dorm.id=:id").setParameter("id", id).list();
	}
	
}
